package com.gitee.cirnochat.common.event;


import com.gitee.cirnochat.login.model.enums.DeviceType;
import com.gitee.cirnochat.user.model.enums.UserStatus;

/**
 * 用户事件工厂
 *
 */
public final class UserEventFactory {

    private UserEventFactory() {
        // Prevent instantiation
        throw new UnsupportedOperationException("Cannot instantiate utility class");
    }

    public static UserEvent createUserEvent(Object source, Long userId, UserStatus eventType, String deviceId, String deviceName , DeviceType deviceType) {
        return switch (eventType) {
            case ONLINE -> new UserOnlineEvent(source, userId, eventType,deviceId,deviceName, deviceType);
            case OFFLINE -> new UserOfflineEvent(source, userId, eventType,deviceId,deviceName, deviceType);
        };
    }

}
